summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-09-14 15:24:27 +0200
committerGitHub <noreply@github.com>2023-09-14 15:24:27 +0200
commit48dec7e0c9e7a7e735438ca58e024a894975b45a (patch)
tree59e68c6dd5859811eb269583d0ed9b72ea990851
parentMerge pull request #11433 from liamwhite/shutdown-oopsie (diff)
parentLook for the most recently modified image for present (diff)
downloadyuzu-48dec7e0c9e7a7e735438ca58e024a894975b45a.tar
yuzu-48dec7e0c9e7a7e735438ca58e024a894975b45a.tar.gz
yuzu-48dec7e0c9e7a7e735438ca58e024a894975b45a.tar.bz2
yuzu-48dec7e0c9e7a7e735438ca58e024a894975b45a.tar.lz
yuzu-48dec7e0c9e7a7e735438ca58e024a894975b45a.tar.xz
yuzu-48dec7e0c9e7a7e735438ca58e024a894975b45a.tar.zst
yuzu-48dec7e0c9e7a7e735438ca58e024a894975b45a.zip
-rw-r--r--src/video_core/texture_cache/texture_cache.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 4457b366f..1bdb0def5 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -719,6 +719,7 @@ typename P::ImageView* TextureCache<P>::TryFindFramebufferImageView(VAddr cpu_ad
return nullptr;
}
const auto& image_map_ids = it->second;
+ boost::container::small_vector<const ImageBase*, 4> valid_images;
for (const ImageMapId map_id : image_map_ids) {
const ImageMapView& map = slot_map_views[map_id];
const ImageBase& image = slot_images[map.image_id];
@@ -728,8 +729,20 @@ typename P::ImageView* TextureCache<P>::TryFindFramebufferImageView(VAddr cpu_ad
if (image.image_view_ids.empty()) {
continue;
}
- return &slot_image_views[image.image_view_ids.at(0)];
+ valid_images.push_back(&image);
}
+
+ if (valid_images.size() == 1) [[likely]] {
+ return &slot_image_views[valid_images[0]->image_view_ids.at(0)];
+ }
+
+ if (valid_images.size() > 0) [[unlikely]] {
+ std::ranges::sort(valid_images, [](const auto* a, const auto* b) {
+ return a->modification_tick > b->modification_tick;
+ });
+ return &slot_image_views[valid_images[0]->image_view_ids.at(0)];
+ }
+
return nullptr;
}